package com.oracle.dao;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.oracle.entity.po.StorePO;
import com.oracle.entity.po.WarehousePO;
import com.oracle.entity.vo.StoreDetailVO;
import com.oracle.entity.vo.StoreVO;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface WarehouseDao extends BaseMapper<WarehousePO> {

    @Select("SELECT * from VIEW_TOTAL_STORE")
     List<StoreVO> getStore();

    @Select("SELECT * from VIEW_WAREHOUSE_DETAIL where id = #{ID}")
    List<StoreDetailVO> getStoreDetail(@Param("ID") int id);

    @Insert("insert into store(goods_id,warehouse_id,num) values(#{goodsId},#{warehouseId},#{num})")
    void insertStore(StorePO storePO);

    @Select("update store set num=#{num} where goods_id=#{goodsId} and warehouse_id=#{warehouseId}")
    void updateStore(StorePO storePO);

}
